<form nz-form [formGroup]="addForm" class="modal-add-form" (ngSubmit)="onSubmit($event)">
    <nz-form-item>
        @if (editMode == modeEnum.ADD) {
            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="postName" nzRequired>岗位名称</nz-form-label>
        } @else {
            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="postName">岗位名称</nz-form-label>
        }
        <nz-form-control [nzSm]="14" [nzXs]="24">
            <input class="default-input" nz-input formControlName="postName" placeholder="岗位名称" />
            <div *ngIf="submitted && fm['postName'].invalid" class="alert">
                <div *ngIf="fm['postName'].errors?.['rquired']">请输入岗位名称</div>
                <div *ngIf="fm['postName'].errors?.['minlength']">岗位名称不少于2个字</div>
                <div *ngIf="fm['postName'].errors?.['maxlength']">岗位名称不超过20个字</div>
            </div>
        </nz-form-control>
    </nz-form-item>

    <nz-form-item>
        @if (editMode == modeEnum.ADD) {
            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="postCode" nzRequired>岗位编号</nz-form-label>
        } @else {
            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="postCode">岗位编号</nz-form-label>
        }
        <nz-form-control [nzSm]="14" [nzXs]="24">
            <input class="default-input" nz-input formControlName="postCode" placeholder="岗位编号" />
            <div *ngIf="submitted && fm['postCode'].invalid" class="alert">
                <div *ngIf="fm['postCode'].errors?.['rquired']">请输入岗位编号</div>
                <div *ngIf="fm['postCode'].errors?.['minlength']">岗位编号不少于1个字</div>
                <div *ngIf="fm['postCode'].errors?.['maxlength']">岗位编号不超过64个字</div>
            </div>
        </nz-form-control>
    </nz-form-item>

    <nz-form-item>
        @if (editMode == modeEnum.ADD) {
            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="postSort" nzRequired>排序</nz-form-label>
        } @else {
            <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="postSort">排序</nz-form-label>
        }
        <nz-form-control [nzSm]="14" [nzXs]="24">
            <input class="default-input" nz-input formControlName="postSort" placeholder="排序" />
        </nz-form-control>
    </nz-form-item>

    <nz-form-item>
        <nz-form-label nzFor="enabled" [nzSm]="6" [nzXs]="24">状态</nz-form-label>
        <nz-form-control [nzSm]="14" [nzXs]="24">
            <nz-select class="role-enabled" name="enabled" formControlName="enabled">
                <nz-option [nzValue]="true" nzLabel="启用"></nz-option>
                <nz-option [nzValue]="false" nzLabel="停用"></nz-option>
            </nz-select>
        </nz-form-control>
    </nz-form-item>

    <nz-form-item>
        <nz-form-label [nzSm]="6" [nzXs]="24" nzFor="remark">描述</nz-form-label>
        <nz-form-control [nzSm]="14" [nzXs]="24">
            <textarea class="default-input" rows="4" nz-input formControlName="remark" placeholder=""></textarea>
            <div *ngIf="submitted && fm['remark'].invalid" class="alert">
                <div *ngIf="fm['remark'].errors?.['maxlength']">组标签不超过1024个字</div>
            </div>
        </nz-form-control>
    </nz-form-item>

    <div nz-row nzJustify="end" class="action-area">
        <div nz-col>
            <button class="dialog-button" nz-button [nzType]="'primary'">添加</button>
            <button class="dialog-button" nz-button (click)="onCancel($event)">取消</button>
        </div>
    </div>
</form>